package com.sjzxywlkj.cplife.alipay.result;

import java.util.HashMap;
import java.util.Map;

import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipayDataDataserviceBillDownloadurlQueryResponse;
import com.sjzxywlkj.cplife.alipay.conn.BillDownConn;
import com.sjzxywlkj.cplife.alipay.request.entity.BillDown;
import com.sjzxywlkj.cplife.alipay.response.entity.BillDownResult;
import com.sjzxywlkj.cplife.alipay.response.entity.PublicParameters;

/**
 * 账单下载返回结果
 */
public class BillDownAlipay {

    public static Map<String, Object> trade(String bill_date, String app_auth_token) throws AlipayApiException {
        AlipayDataDataserviceBillDownloadurlQueryResponse response = BillDownConn.query(new BillDown("trade", bill_date), app_auth_token);


        Map<String, Object> result = new HashMap<String, Object>();
        PublicParameters parameters = new PublicParameters(response.getCode(), response.getMsg(), response.getSubCode(), response.getSubMsg(), null);
        BillDownResult billDownResult = new BillDownResult(response.getBillDownloadUrl());
        result.put("parameters", parameters);
        result.put("billDownResult", billDownResult);
        return result;

    }

    public static Map<String, Object> signcustomer(String bill_date, String app_auth_token) throws AlipayApiException {

        AlipayDataDataserviceBillDownloadurlQueryResponse response = BillDownConn.query(new BillDown("signcustomer", bill_date), app_auth_token);


        Map<String, Object> result = new HashMap<String, Object>();
        PublicParameters parameters = new PublicParameters(response.getCode(), response.getMsg(), response.getSubCode(), response.getSubMsg(), null);
        BillDownResult billDownResult = new BillDownResult(response.getBillDownloadUrl());
        result.put("parameters", parameters);
        result.put("billDownResult", billDownResult);
        return result;


    }
}
